// 自定义一个hook函数，实现获取滚动距离Y
import {useState} from 'react'
export function useWindowScroll (){
    const [y,setY] = useState(0)
    window.addEventListener('scroll',()=>{
        const h = document.documentElement.scrollTop
        setY(h)
    })
    return [y]
}
const [y] = useWindowScroll()

